//package com.example.yilanchatserver.business.freechat.service.impl;
//
//import com.alibaba.fastjson.JSONObject;
//import io.netty.channel.ChannelOption;
//import io.netty.handler.timeout.ReadTimeoutHandler;
//import io.netty.handler.timeout.WriteTimeoutHandler;
//import org.apache.commons.codec.digest.DigestUtils;
//import org.springframework.http.client.reactive.ReactorClientHttpConnector;
//import org.springframework.web.reactive.function.client.ExchangeFilterFunction;
//import reactor.netty.http.client.HttpClient;
//import java.time.Duration;
//import java.util.concurrent.TimeUnit;
//
//import com.example.yilanchatserver.business.freechat.service.FuJiaService;
//import lombok.extern.slf4j.Slf4j;
//import org.springframework.http.HttpHeaders;
//import org.springframework.http.HttpStatus;
//import org.springframework.http.MediaType;
//import org.springframework.stereotype.Service;
//import org.springframework.web.reactive.function.client.WebClient;
//import org.springframework.web.reactive.function.client.WebClientResponseException;
//import reactor.core.publisher.Flux;
//import reactor.core.publisher.Mono;
//import reactor.netty.http.client.HttpClient;
//
//import javax.annotation.PostConstruct;
//
///**
// * @author : lank
// * @since : 2024-10-18
// * impl
// */
//@Slf4j
//@Service
//public class FuJiaServiceImpl2 implements FuJiaService {
//    private WebClient webClient;
//
//    /**
//     * dev采用代理访问
//     */
//    @PostConstruct
//    public void init() {
//        initProd();
//    }
//
//
//    public void initProd() {
//        log.info("initProd");
//        this.webClient = WebClient.builder()
//                .defaultHeader(HttpHeaders.CONTENT_TYPE, "application/json")
//                .build();
//    }
//
//
//    @Override
//    public Flux<String> send(String question) {
//        log.info("收到问题=============:" + question);
//            JSONObject talkerParams = new JSONObject();
//            talkerParams.put("question", question);
//            talkerParams.put("needSimplifyMessage", true);
//
//            Flux<String> zhiPuResponse = webClient.post()
//                    .uri("https://api-botx.dingtax.cn/bot/api/v1/open/llm/chat/id4ZgWuT9fdWPcLbgJVqxVhP?appkey=cda851f488784e16a98819ee868a48ce&sign=5fdf5de7bb93e165eb9bbf07c0e885af&t=1728977213")
//                    .accept(MediaType.TEXT_EVENT_STREAM)
//                    .bodyValue(talkerParams.toJSONString())
//                    .retrieve()
//                    .bodyToFlux(String.class);
//            return zhiPuResponse;
//    }
//
//    public static void main(String[] args) {
//          String appkey = "cda851f488784e16a98819ee868a48ce";
//          String appsercet = "6ccf25c6eefd48e6ab41812942f59fa7";
//        long time = System.currentTimeMillis() / 1000;
//            String sign = DigestUtils.md5Hex(appsercet + "appkey" + appkey + "t" + time);
//        System.out.println(time);
//        System.out.println(sign);
//    }
//}
